package com.ocom.xcxapi.controller;

import com.ocom.common.constant.WxServiceUrl;
import com.ocom.common.request.payhandle.GetWxGhParamRequest;
import com.ocom.common.request.xcx.XcxUserInfoVo;
import com.ocom.common.resp.Result;
import com.ocom.security.authentication.YoCiUser;
import com.ocom.security.utils.SecurityUtils;
import com.ocom.xcxapi.client.PayHandleClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@PreAuthorize("hasRole('ROLE_XCX')")
@RestController
public class WxGhController {
    @Autowired
    private PayHandleClientService payHandleClientService;


    @PostMapping(WxServiceUrl.URL_snTicket)
    public Result snTicket(@RequestBody GetWxGhParamRequest request) {
        YoCiUser ciUser = SecurityUtils.getYoCiUser();
        request.setCompanyId(ciUser.getComId());
        return payHandleClientService.getWxGhParam(request);
    }


}
